#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

class Gift
{
public:
    int getValue(vector<int> gifts, int n)
    {
        unordered_map<int, int> m;
        for (int i = 0; i < n; ++i)
        {
            m[gifts[i]]++;
            if (m[gifts[i]] > n / 2)
            {
                return gifts[i];
            }
        }
        return 0;
    }
};